package com.iflytek.cosmo.ocr.common.startup;

import com.iflytek.cosmo.ocr.common.config.ArgusProperties;
import com.iflytek.cosmo.ocr.service.ArgusPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * OCR启动时执行
 * @author admin
 */
@Component
public class OcrStartupRunner implements CommandLineRunner {

    /**
     * ttsVersion
     */
    @Value("${ocr.version}")
    private String ocrVersion;
    /**
     * ArgusProperties
     */
    @Autowired
    private ArgusProperties argusProperties;

    /**
     * ArgusPostService
     */
    @Autowired
    private ArgusPostService argusPostService;

    /**
     * Callback used to run the bean.
     *
     * @param args incoming main method arguments
     * @throws Exception on error
     */
    @Override
    public void run(String... args) {
        argusPostService.postAgent(argusProperties.getDefaultClientIp(), argusProperties.getOcrVersion(),
                ocrVersion, "", null);
    }
}
